<template>
<div id="d1" style="margin:auto; width:30%">
<div><h3 style="text-align: center;">注册界面</h3></div>
    <el-form :model="form" ref="registForm" label-width="100px" class="demo-ruleForm">
        <el-form-item label="账户" :label-width="formLabelWidth">
          <el-input v-model="form.uAccount" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="密码" :label-width="formLabelWidth">
          <el-input v-model="form.uPassword" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="昵称" :label-width="formLabelWidth">
          <el-input v-model="form.uNickname" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="真实姓名" :label-width="formLabelWidth">
          <el-input v-model="form.uName" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="身份证号" :label-width="formLabelWidth">
          <el-input v-model="form.uCardid" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="手机号" :label-width="formLabelWidth">
          <el-input v-model="form.uTel" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="邮箱" :label-width="formLabelWidth">
          <el-input v-model="form.uEmail" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="地址" :label-width="formLabelWidth">
          <el-input v-model="form.uAddress" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item>
        <el-button type="primary" @click="regist">提交</el-button>
        <el-button type="primary" @click="resetForm">重置</el-button>
    </el-form-item>
</el-form>
</div>
</template>

<script>
export default {
    data(){
        return {
            form:{
                uAccount:"",
                uPassword:"",
                uNickname:"",
                uName:"",
                uCardid:"",
                uTel:"",
                uEmail:"",
                uAddress:"",
                uState:2
            },
            formLabelWidth :"80px"     
        };
    },
    methods:{
        regist(){
        this.$axios.post("/user/save",this.form)
        .then((resp)=>{
            if(resp.data.code==200){
                this.$message.success("注册成功！");
                this.$router.push("/Login");
            }else{
                this.$message.error("注册失败！");
            }
        });
      },
        resetForm() {
            this.form={}
      }
        
    }
}
</script>

<style>

</style>